var tid = localStorage.getItem("m20102tid");
if(tid==null)
mui.alert('未正确跳转','提示','确认',function (e) {},'div');

var mr = ID("m213root");

function ID(id)
{
	return document.getElementById(id);
}
function CN(className)
{
	return document.getElementsByClassName(className);
}

function m201021Init()
{
	var tdata = {'tid':tid};
	mui.ajax(ASYURI+'M201021.do',{
		data: tdata,
		dataType:'json',//服务器返回json格式数据
		type:'post',//HTTP请求类型
		timeout:10000,//超时时间设置为10秒；
		success:function(data){
			if(data.tag=='1')
			{
				mui.alert('查询出错或该组无独属于该组的组问卷','提示','确认',function (e) { },'div');
			}
			else if(data.tag=='0')
			{
				var sdata = data[1];
				var slen = sdata.length;
				
				var ul = mainListInit();
				
				for(mi=0;mi<slen;mi++)
				{
					var ssd = sdata[mi];
					var li = mainItemInit(ssd.A1011,ssd.A1010);
					ul.appendChild(li);
				}
				mr.appendChild(ul);
			}
		},
		error:function(xhr,type,errorThrown){
			
		}
	});
}

function mainListInit()
{
/**
<ul class="mui-table-view">
	<li class="mui-table-view-cell">
		<a class="mui-navigate-right">
			Item 1
		</a>
	</li>
</ul>
 */
	var ul = document.createElement("ul");
	ul.setAttribute("class","mui-table-view");
	return ul;
}
function mainItemInit(lVal1,lVal2)
{
	var li = document.createElement("li");
	li.setAttribute("class","mui-table-view-cell");
	li.innerHTML = lVal1;
	var btn = document.createElement("button");
	btn.setAttribute("type","button");
	btn.setAttribute("id","b"+lVal2);
	btn.setAttribute("class","mui-btn mui-btn-blue");
	btn.setAttribute("onclick","toAnswer('"+lVal2+"','"+lVal1+"')");
	btn.innerHTML="回答该问卷";
	li.appendChild(btn);
	return li;
}
function toAnswer(qid,title)
{
	localStorage.setItem("m101qid",qid);
	localStorage.setItem("m101title",title);
	mui.openWindow("m101.html");
}

m201021Init();